Talk:Thinker

Language standard conflicts
I don't believe it is true that casting a pointer to a struct to a pointer to its first element and back is illegal in C11.

The standard explicitly addresses this. Referring to https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf:

§6.7.2.1p15: "A pointer to a structure object, suitably converted, points to its initial member (or if that member is a bit-field, then to the unit in which it resides), and vice versa."

The strict aliasing rules (§6.5p7) permit this as well; the compiler must treat an lvalue of the same type as a member of a struct as a potential alias.

- 78.82.191.180 11:41, 28 December 2022 (CST)


 * This was the general understanding of the entire Doom community at the time that the rules went into effect and compilers started issuing diagnostics against the reverse casts (such as back to ). I am not sure if the compilers were wrong at the time, if the standard has changed, or if we were mistaken about how general the problem was and only certain kinds of these casts were really causing problems not related to what I'm thinking of. It's been 20-odd years unfortunately. --Quasar (talk) 00:54, 30 December 2022 (CST)